package com.intmall.train.common.domain.resp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class CommonResp<T> {
    /**
     * 业务上的成功或失败
     */
    private boolean success = true;

    /**
     * 返回信息
     */
    private String message;

    /**
     * 返回泛型数据，自定义类型
     */
    private T data;

    public CommonResp(T data) {
        this.data = data;
    }

    public static CommonResp SUCCESS() {
        return new CommonResp<>();
    }

    public static <T> CommonResp<T> SUCCESS(T content) {
        return new CommonResp<>(content);
    }

}
